package com.md.domain.model.po;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.md.base.BasePO;
import com.md.util.StringUtil;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * 角色表
 *
 * @author 刘骄阳
 * @since 2022-04-12
 */
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Role extends BasePO {

  private static final long serialVersionUID = 1L;

  /**
   * 角色名
   */
  private String name;

  /**
   * 父级id(根级的父级是-1)
   */
  @JsonFormat(shape = JsonFormat.Shape.STRING)
  private Long parentId;

  /**
   * 根级id(根级的根级id是自己)
   */
  @JsonFormat(shape = JsonFormat.Shape.STRING)
  private Long rootId;

  // ?是否需要限制子集是否继承父级

  @Override
  public String toString() {
    return StringUtil.objectToJson(this);
  }

}
